Package-level declarations

Types

Link copied to clipboard

Convenience base class for WritableRagService implementations.

Link copied to clipboard

Traditional RAG. Text chunk

Link copied to clipboard
data class Cluster<E>(val anchor: E, val similar: List<<Error class: unknown class><E>>)

Cluster of similar things

Link copied to clipboard
interface ClusterFinder
Link copied to clipboard
data class ClusterRetrievalRequest<E> constructor(val entitySearch: EntitySearch? = null, val contentElementSearch: ContentElementSearch = ContentElementSearch.NONE, val similarityThreshold: <Error class: unknown class> = 0.7, val topK: Int = 10, val vectorIndex: String = "embabel-entity-index") : RetrievalFilters<ClusterRetrievalRequest<E>>
Link copied to clipboard
open class CompressionConfig(val enabled: Boolean = true)
Link copied to clipboard
Link copied to clipboard
interface ContentElement : Datum

Structural content element that may have a parent and children. Textual.

Link copied to clipboard
data class ContentElementSearch(val types: List<Class<out ContentElement>>)
Link copied to clipboard

Root of a structured document It must have a non-null URI

Link copied to clipboard
data class ContextualTool(val toolCallback: <Error class: unknown class>) : Retrievable

Tool retrieved by a RAG request

Link copied to clipboard
sealed interface Datum

Data object instance, whether structural or not.

Link copied to clipboard
Link copied to clipboard
interface Embeddable
Link copied to clipboard
interface Embedded

Embedded object instance.

Link copied to clipboard
data class EnhancementEstimate(val expectedQualityGain: Double, val estimatedLatencyMs: Long, val estimatedTokenCost: Int, val recommendation: EnhancementRecommendation)
Link copied to clipboard
Link copied to clipboard

Generic retrieved entity

Link copied to clipboard
open class EntitySearch(val labels: Set<String>, val generateQueries: Boolean = false)

Controls entity search Open to allow specializations

Link copied to clipboard
sealed interface ExplorationRequest
Link copied to clipboard
data class Fact(val assertion: String, val authority: String, val uri: String? = null, val metadata: Map<String, Any?> = emptyMap(), val id: String = UUID.randomUUID().toString()) : Source

A fact.

Link copied to clipboard

ContentElement that exists in a hierarchy, such as a document with sections and subsections.

Link copied to clipboard
data class HyDE constructor(val wordCount: Int = 50)

Hypothetical Document Embedding Used to generate a synthetic document for embedding from the query.

Link copied to clipboard
data class LeafSection(val id: String, val uri: String? = null, val title: String, val text: String, val parentId: String? = null, val metadata: Map<String, Any?> = emptyMap()) : MaterializedSection, HasContent

Contains content

Link copied to clipboard
Link copied to clipboard

Adds a name to the well known entity data.

Link copied to clipboard
@ApiStatus.Experimental
interface NavigableRagService : RagService

Rag service that supports navigation in a graph of retrievable objects. This may not be supported by all RAG services. It need not be a graph but could be implemented by a relational database or other structure.

Link copied to clipboard
Link copied to clipboard
data class QualityMetrics(val faithfulness: <Error class: unknown class>, val answerRelevancy: <Error class: unknown class>, val contextPrecision: <Error class: unknown class>, val contextRecall: <Error class: unknown class>, val contextRelevancy: <Error class: unknown class>, val overallScore: <Error class: unknown class> = computeRAGASScore( faithfulness, answerRelevancy, contextPrecision, contextRecall, contextRelevancy, ))

RAGAS quality metrics

Link copied to clipboard
data class RagRequest(val query: String, val similarityThreshold: <Error class: unknown class> = 0.8, val topK: Int = 8, val hyDE: HyDE? = null, val desiredMaxLatency: Duration = Duration.ofMillis(5000), val compressionConfig: CompressionConfig = CompressionConfig(), val contentElementSearch: ContentElementSearch = ContentElementSearch.CHUNKS_ONLY, val entitySearch: EntitySearch? = null, val timestamp: Instant = Instant.now()) : RagRequestRefinement<RagRequest>

RAG request. Contains a query and parameters for similarity search.

Link copied to clipboard

Narrowing of RagRequest

Link copied to clipboard
data class RagResponse(val request: RagRequest, val service: String, val results: List<<Error class: unknown class><out Retrievable>>, val enhancement: RagResponseEnhancement? = null, val qualityMetrics: QualityMetrics? = null, val timestamp: Instant = Instant.now())

Rag response RagResponses can contain results from multiple RAG services. Results are not necessarily chunks, but can be entities.

Link copied to clipboard
data class RagResponseEnhancement(val enhancer: RagResponseEnhancer, val basis: RagResponse, val processingTimeMs: Long = 0, val tokensProcessed: Int = 0, val enhancementType: EnhancementType, val qualityImpact: <Error class: unknown class>? = null)
Link copied to clipboard
Link copied to clipboard
fun interface RagResponseFormatter

Implemented by classes that can format RagResponse objects into a string for inclusion in tool responses or prompts.

Link copied to clipboard
Link copied to clipboard
interface RagService

Central interface for Retrieval-Augmented Generation (RAG) services. Returns entities as well as text chunks.

Link copied to clipboard
Link copied to clipboard
data class RagServiceEnhancerProperties(val compressionLlm: <Error class: unknown class> = LlmOptions.withAutoLlm(), val rerankingLlm: <Error class: unknown class> = LlmOptions.withAutoLlm(), val maxConcurrency: Int = 12)
Link copied to clipboard

A Retrievable object instance is a Datum (normally a chunk or an entity) that can be retrieved by RAG. It has a stable id.

Link copied to clipboard

Any retrievable entity, whether mapped or generic.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
data class SimpleEntityData(val id: String, val uri: String? = null, val labels: Set<String>, val properties: Map<String, Any>, val metadata: Map<String, Any?> = emptyMap()) : EntityData
Link copied to clipboard
data class SimpleNamedEntityData(val id: String, val uri: String? = null, val name: String, val description: String, val labels: Set<String>, val properties: Map<String, Any>, val metadata: Map<String, Any?> = emptyMap()) : NamedEntityData
Link copied to clipboard

Sensible default RagResponseFormatter

Link copied to clipboard
sealed interface Source : Retrievable

A Source object instance is an input such as a Chunk or a Fact. It was provided to the system as data; it is not inferred by the system, but a direct piece of data.

Link copied to clipboard
interface Sourced

Implemented by objects that are from a source.

Link copied to clipboard
open class TypedEntitySearch(val entities: List<Class<*>>, val generateQueries: Boolean = false) : EntitySearch
Link copied to clipboard

WritableRagService that also allows us to load and save ContentElements.

Link copied to clipboard
interface WritableStore

RagService that can accept documents

Functions

Link copied to clipboard
fun computeRAGASScore(faithfulness: Double, answerRelevancy: Double, contextPrecision: Double, contextRecall: Double, contextRelevancy: Double): Double